package com.heima.minio.test;


import com.heima.file.service.FileStorageService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

@SpringBootTest
@RunWith(SpringRunner.class)
public class MinIOTest2 {

    @Autowired
    private FileStorageService fileStorageService;

    @Test
    public void testUploadHtml() throws FileNotFoundException {

        //读一个文件
        FileInputStream fileInputStream = new FileInputStream("E:\\tmp\\list.html");

        String path = fileStorageService.uploadHtmlFile("", "list.html", fileInputStream);

        System.out.println(path);
    }

    @Test
    public void testDeleteHtml(){
        fileStorageService.delete("http://192.168.200.130:9000/leadnews/2022/03/15/list.html");
    }


}
